package com.winshare.saleAssistant.service.impl;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.winshare.saleAssistant.dao.SaleImportLogMapper;
import com.winshare.saleAssistant.domain.dto.req.PageQueryDTO;
import com.winshare.saleAssistant.domain.dto.req.UserQueryDTO;
import com.winshare.saleAssistant.model.SaleImportLog;
import com.winshare.saleAssistant.model.SchoolHardware;
import com.winshare.saleAssistant.service.ISaleImportLogService;
import com.winshare.saleAssistant.util.Page;
import com.winshare.saleAssistant.util.ToolUtil;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * <p>
 * 销售数据-导入历史 服务实现类
 * </p>
 *
 * @author stylefeng
 * @since 2020-11-11
 */
@Service
public class SaleImportLogServiceImpl extends ServiceImpl<SaleImportLogMapper, SaleImportLog> implements ISaleImportLogService {

    @Override
    public String getSynchronousTime() {
        return this.baseMapper.getSynchronousTime();
    }

    @Override
    public Page<SaleImportLog> getSaleImportLog(PageQueryDTO pageQueryDTO) {
        int totalCount = this.baseMapper.selectCount(null);
        Integer pageIndex = pageQueryDTO.getPageIndex();
        Integer pageSize = pageQueryDTO.getPageSize();
        if (0 == totalCount) {
            return new com.winshare.saleAssistant.util.Page<>(pageIndex, pageSize, totalCount, new ArrayList<>());
        } else {
            return new com.winshare.saleAssistant.util.Page<>(pageIndex, pageSize, totalCount, this.baseMapper.getSaleImportLogByPage(pageQueryDTO));
        }
    }
}
